//
//  SaveManager.m
//  KingSelected
//
//  Created by 杨鹏 on 2023/10/28.
//

#import "SaveManager.h"

@implementation SaveManager

+ (void)saveUserModel:(UserModel *)model {
    NSData *data = [NSKeyedArchiver archivedDataWithRootObject:model];
    [[NSUserDefaults standardUserDefaults] setObject:data forKey:@"user"];
    [[NSUserDefaults standardUserDefaults] synchronize];
}
+ (UserModel *)getUserModel {
    NSData *data = [[NSUserDefaults standardUserDefaults] objectForKey:@"user"];
    UserModel *user = [NSKeyedUnarchiver unarchiveObjectWithData:data];
    return user;
}
+ (void)clearUserModel {
    [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"user"];
    [[NSUserDefaults standardUserDefaults] synchronize];
}

@end
